﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data;

namespace QLHH
{
    public partial class Login : Window
    {
        public Login()
        {
            InitializeComponent();
        }
        private void Expander_Expanded(object sender, RoutedEventArgs e)
        {
            this.Height = 380;
        }

        private void Expander_Collapsed(object sender, RoutedEventArgs e)
        {
            this.Height = 280;

        }

        private void btDongY_Click(object sender, RoutedEventArgs e)
        {
            Users usr = new Users();
            string users = cbTenNguoiDung.Text;
            string pass = pbMauKhau.Password;
            DataTable tb =usr.DanhSachUsers(users,pass);
            if (tb.Rows.Count > 0)
            {
                this.Close();
            }
            else
            {
                MessageBox.Show("Tên đăng nhập hoặc mật khẩu không chính xác!","Cảnh Báo",MessageBoxButton.OK,MessageBoxImage.Error);
            }
        }

            //Users usr = new Users();
            //string user = cbTenNguoiDung.Text;
            //string pass = pbMauKhau.Password;
            //DataTable dt = usr.DanhSachUsers(user, pass);
            //if (dt.Rows.Count > 0)
            //{
            //    this.Close();
            //}
            //else
            //{
            //    MessageBoxResult result = MessageBox.Show("nhap sai roi", "thong bao", MessageBoxButton.OK, MessageBoxImage.Warning);
            //}


        private void btThoat_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
